home *** CD-ROM | disk | FTP | other *** search
- /*
-
- file : bitstr_h.h
- author : Erik Mavrinac
- version : 1.20 11/25/90
-
- description: Stand-alone header file that, by itself, allows use of the
- bitstring functions. Do not use in conjunction with bitstr_f.c or
- bitstr_f.h. See the bitstr.doc file for more details.
-
- */
-
- /* size of unsigned int in bits */
- #define US 16
-
- /* CPU-specific hexadecimal definition of rightmost bit set (only) */
- #define HEX1 ((unsigned) 0x0001)
-
-
- /* void clear_bit(unsigned *bitstr, int bit) */
- #define clear_bit(x,y) (*((x)+(y)/US) &= (~(HEX1 << (US-1-((y) % US)))))
-
- /* void set_bit(unsigned *bitstr, int bit) */
- #define set_bit(x,y) (*((x)+(y)/US) |= (HEX1 << (US-1-((y) % US))))
-
- /* int test_bit(unsigned *bitstr, int bit) */
- #define test_bit(x,y) (*((x)+(y)/US) & (HEX1 << (US-1-((y) % US))))
-